package com.aaa.mythread;

public class MyThread4scaleticket extends Thread{


    private int ticket=30;


    @Override
    public void run() {
        //  业务

       while (ticket>0){
           // Thread.currentThread()  获取的是当前的线程
           // getName  -》线程的名字
           System.out.println(Thread.currentThread().getName()+"卖出了一张票，还有"+ticket--);
       }

    }


    public static void main(String[] args) {
        MyThread4scaleticket myThread4scaleticket = new MyThread4scaleticket();
        Thread thread = new Thread(myThread4scaleticket,"zs");// 4  2
        Thread thread2 = new Thread(myThread4scaleticket,"ls");// 3 3
        Thread thread3 = new Thread(myThread4scaleticket,"ww");// 3 3
        Thread thread4 = new Thread(myThread4scaleticket,"ww1");// 3 3

        thread.start();
        thread2.start();
        thread3.start();
        thread4.start();

    }
}
